<?php

namespace App\Admin\Forms\Tenant;

use App\Wen\Utils\FieldUtils;
use App\Wen\Utils\Settings;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;

class PayModelCodeForm2 extends Form implements LazyRenderable
{
    use LazyWidget;

    public function handle(array $input)
    {
        for ($i = 11; $i <= 20; $i++){
            if(isset($input['mini_pay_code_'.$i])){
                Settings::set('mini_pay_code_'.$i, $input['mini_pay_code_'.$i], true);
            }
        }

        return $this->response()
            ->success('配置成功')
            ->refresh();
    }

    public function form()
    {

            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费11：( 核销，卡密，虚拟) 商品</div>';
            }, '');
            $this->image('mini_pay_code_11', '付费11')->help('<a href="https://img.mini.minisns.cn/2023/05/06/2c05553eacc02ba730f02889198181e1.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_11', 'https://img.mini.minisns.cn/2023/05/06/2c05553eacc02ba730f02889198181e1.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费12：实时热榜</div>';
            }, '');
            $this->image('mini_pay_code_12', '付费12')->help('<a href="https://img.mini.minisns.cn/2023/05/06/e32c4861fb43f8fe59008b13f64806ca.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_12', 'https://img.mini.minisns.cn/2023/05/06/e32c4861fb43f8fe59008b13f64806ca.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费13：淘客</div>';
            }, '');
            $this->image('mini_pay_code_13', '付费13')->help('<a href="https://img.mini.minisns.cn/2023/09/04/38292f7ea53932fb984d38756989d434.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_13', 'https://img.mini.minisns.cn/2023/09/04/38292f7ea53932fb984d38756989d434.png'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费14：广告</div>';
            }, '');
            $this->image('mini_pay_code_14', '付费14')->help('<a href="https://img.mini.minisns.cn/2023/05/05/0074a494fc254d722488fdd41863aa54.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_14', 'https://img.mini.minisns.cn/2023/05/05/0074a494fc254d722488fdd41863aa54.jpg'));
//            $this->image('mini_pay_code_15', '付费15：广告')->help('<a href="https://img.mini.minisns.cn/2023/05/05/0074a494fc254d722488fdd41863aa54.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_15', 'https://img.mini.minisns.cn/2023/05/05/0074a494fc254d722488fdd41863aa54.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费16：迷你会员</div>';
            }, '');
            $this->image('mini_pay_code_16', '付费16')->help('<a href="https://img.mini.minisns.cn/2023/06/02/1c47e36d1d134c18b53accc13250d5a9.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_16', 'https://img.mini.minisns.cn/2023/06/02/1c47e36d1d134c18b53accc13250d5a9.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费17：金币抵扣组合支付</div>';
            }, '');
            $this->image('mini_pay_code_17', '付费17')->help('<a href="https://img.mini.minisns.cn/2023/05/06/afdb97216a837dcdd1c8665c3c05ee7f.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_17', 'https://img.mini.minisns.cn/2023/05/06/afdb97216a837dcdd1c8665c3c05ee7f.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费18：语音功能</div>';
            }, '');
            $this->image('mini_pay_code_18', '付费18')->help('<a href="https://img.mini.minisns.cn/2023/05/20/f5103e7535efd5119dfce095fc169c43.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_18', 'https://img.mini.minisns.cn/2023/05/20/f5103e7535efd5119dfce095fc169c43.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费19：App窗口进出动画自定义</div>';
            }, '');
            $this->image('mini_pay_code_19', '付费19')->help('<a href="https://img.mini.minisns.cn/2023/05/20/94c0fc874823266cf0b56c385ad2d9eb.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_19', 'https://img.mini.minisns.cn/2023/05/20/94c0fc874823266cf0b56c385ad2d9eb.jpg'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费20：团队推广三级裂变</div>';
            }, '');
            $this->image('mini_pay_code_20', '付费20')->help('<a href="https://img.mini.minisns.cn/2023/05/31/48d47b6f319126513410698920bf7eb7.jpg" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_20', 'https://img.mini.minisns.cn/2023/05/31/48d47b6f319126513410698920bf7eb7.jpg'));
    }
}
